package cn.edu.hqu.javaee.web;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.edu.hqu.javaee.domain.Result;

@Controller	 
@Scope("singleton")
@RequestMapping("/result")
public class ResultController{
	@GetMapping
	public String choose(Model model) {
		model.addAttribute("result",new Result());
		 System.out.println("Model"+model);
		return "last";
	}
	 @PostMapping
	 public String processResultPersonal(@ModelAttribute("result") Result result,ModelMap model) {
	   System.out.println("post"+result);
	   System.out.println("postModel"+model.get("result"));	   
	   return "last";
	 }	
}